﻿using B.MES.Customer.Infrastructure.IRepository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace B.MES.Orders.Infrastructure
{
    public class BaseApplication<T> : IBaseApplication<T> where T : class, new()
    {
        private readonly IBaseRepository<T> _baseRepository;
        public BaseApplication(IBaseRepository<T> baseRepository)
        {
            _baseRepository = baseRepository;
        }

        public bool Delete(T entity)
        {
            return _baseRepository.Delete(entity);
        }

        public List<T> GetAll()
        {
            return _baseRepository.GetAll();
        }

        public T GetById(object id)
        {
            return _baseRepository.GetById(id);
        }

        public List<T> GetList(Expression<Func<T, bool>> whereExpression)
        {
            return _baseRepository.GetList(whereExpression);
        }

        public bool Insert(T entity)
        {
            return _baseRepository.Insert(entity);
        }

        public bool Update(T entity)
        {
            return _baseRepository.Update(entity);
        }
    }
}
